home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.07 Jul 90 / Printing Primer ƒ / ReportUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-09  |  3.3 KB  |  118 lines  |  [TEXT/KAHL]

  1. /*******************************************\
  2. *    file:         PrintUtils.h                *
  3. *    version:    1.0ß                        *
  4. *                                            *
  5. * -----------------------------------------    *
  6. * By:    Donald Koscheka                        *
  7. * Date:    30-OCT-89                            *
  8. * ©    Copyright 1989, Donald Koscheka            *
  9. *    All Rights Reserved                        *
  10. *                                            *
  11. * -----------------------------------------    *
  12. \*******************************************/
  13.  
  14.                 /********************************************/
  15.                 /*            --- CONSTANTS ---                */
  16.                 /********************************************/
  17.  
  18. #define    CARD        TRUE
  19. #define    BKGND        FALSE
  20. #define    NULL        0x00
  21. #define    TAB            0x09
  22. #define    CR            0x0D
  23. #define    LF            0x0A
  24. #define    FF            0x0C 
  25. #define    QUOTE        0x22 
  26. #define    COMMA        0x2C 
  27. #define    PERIOD        0x2E
  28. #define    PAREN        0x28
  29.     
  30. #define    TIMES            20
  31. #define    DEFAULT_FONT    20        /*** Times ***/
  32. #define    DEFAULT_SIZE    12
  33. #define    PLAIN_TEXT        0    
  34. #define    teJustFill        2
  35.  
  36. #define    PAGE_INFO    'pifr'
  37. #define    PAGE_ID        128
  38.  
  39. #define        TEXT_JUSTIFICATION    12396
  40. #define        TEXT_STYLES            12549
  41. #define        STRING_TYPE            'STR#'
  42. #define        TEXT_SIZE            10
  43.  
  44. enum{                            /*** different device types            ***/
  45.     Screen = 1,
  46.     Printer,
  47.     File,
  48.     Remote
  49. };
  50.  
  51.  
  52.                 /********************************************/
  53.                 /*            --- TYPE DEFINITIONS ---        */
  54.                 /********************************************/
  55.  
  56. /*** This structure is used internally by    ***/
  57. /*** the printing routines.                    ***/
  58. typedef    struct    styleSet{
  59.     short        Font;            /*** current font                    ***/
  60.     short        Size;            /*** current font size                ***/
  61.     short        Style;            /*** current font style                ***/
  62.     short        Just;            /*** current justification            ***/
  63. }styleSet, *stylePtr;
  64.  
  65.  
  66. /*** footnote                                ***/
  67. /*** this is a study piece only    we'll want to embellish this concept ***/
  68.  
  69. typedef struct{
  70.     Handle    key1;
  71.     Handle    key2;
  72.     Handle    key3;
  73.     short    hite;                /*** if zero, no footnote set        ***/
  74. }foot, *footPtr, *footHand;
  75.  
  76.  
  77. typedef    struct{
  78.     short        portType;        /*** RESERVED FOR FUTURE EXPANSION    ***/
  79.     GrafPtr        prPort;            /*** pointer to the display port    ***/
  80.     Point        curntPen;        /*** where we currently drawing        ***/
  81.     Rect        margin;            /*** "local" paragraph margin        ***/
  82.     styleSet    curntStyle;        /*** current style settings            ***/
  83.     styleSet    defaultStyle;    /*** default style settings            ***/
  84.  
  85.     short        pagecount;        /*** number of the current page        ***/
  86.     short        totalpages;        /*** total pages printed in doc        ***/        
  87.                                 /*** following will go in a union     ***/
  88.                                 /*** so structure can be used for    ***/
  89.                                 /*** for screen drawing also.        ***/
  90.     THPrint        prRecHandle;    /*** Handle to to printing rec.        ***/
  91.     TPrStatus    myStRec;        /*** print style information        ***/
  92.     foot        footNote;
  93. }pInfo, *pInfoPtr, **pInfoHand;
  94.  
  95.  
  96.  
  97.                 /********************************************/
  98.                 /*        --- FUNCTION PROTOTYPES ---            */
  99.                 /********************************************/
  100.             
  101. long     matchToken( Handle buf, short tabl );
  102. long    parseNum( char *bp );
  103. char    *nextToken( char *bp );
  104. void     parseRect( Handle buf, Rect *theRect );
  105. void     PrintString( pInfoPtr pp, Handle theText, short hite );
  106. void     PrintParagraph();
  107. void    CheckPageBreak();    
  108. void    SetMargin( pInfoPtr pp, short t, short l, short b, short r );
  109.  
  110. void    DrawTextRun();
  111.  
  112. void     SetFont( stylePtr sp, short theFont);
  113. void     SetFontSize( stylePtr sp, short theSize);
  114. void     SetFontStyle( stylePtr    pp, short theStyle);
  115. void     SetFontJust( stylePtr sp, short theJust);
  116.  
  117. void    SetFontStyles( pInfoPtr pp, stylePtr sp );
  118.